// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Ml
{
	public sealed partial class ClassificationInferenceOptions : Aggregations.IInferenceConfigVariant, IInferenceConfigCreateVariant, IInferenceConfigUpdateVariant
	{
		[JsonInclude]
		[JsonPropertyName("num_top_classes")]
		public int? NumTopClasses { get; set; }

		[JsonInclude]
		[JsonPropertyName("num_top_feature_importance_values")]
		public int? NumTopFeatureImportanceValues { get; set; }

		[JsonInclude]
		[JsonPropertyName("prediction_field_type")]
		public string? PredictionFieldType { get; set; }

		[JsonInclude]
		[JsonPropertyName("results_field")]
		public string? ResultsField { get; set; }

		[JsonInclude]
		[JsonPropertyName("top_classes_results_field")]
		public string? TopClassesResultsField { get; set; }
	}

	public sealed partial class ClassificationInferenceOptionsDescriptor : SerializableDescriptorBase<ClassificationInferenceOptionsDescriptor>
	{
		internal ClassificationInferenceOptionsDescriptor(Action<ClassificationInferenceOptionsDescriptor> configure) => configure.Invoke(this);
		public ClassificationInferenceOptionsDescriptor() : base()
		{
		}

		private int? NumTopClassesValue { get; set; }

		private int? NumTopFeatureImportanceValuesValue { get; set; }

		private string? PredictionFieldTypeValue { get; set; }

		private string? ResultsFieldValue { get; set; }

		private string? TopClassesResultsFieldValue { get; set; }

		public ClassificationInferenceOptionsDescriptor NumTopClasses(int? numTopClasses)
		{
			NumTopClassesValue = numTopClasses;
			return Self;
		}

		public ClassificationInferenceOptionsDescriptor NumTopFeatureImportanceValues(int? numTopFeatureImportanceValues)
		{
			NumTopFeatureImportanceValuesValue = numTopFeatureImportanceValues;
			return Self;
		}

		public ClassificationInferenceOptionsDescriptor PredictionFieldType(string? predictionFieldType)
		{
			PredictionFieldTypeValue = predictionFieldType;
			return Self;
		}

		public ClassificationInferenceOptionsDescriptor ResultsField(string? resultsField)
		{
			ResultsFieldValue = resultsField;
			return Self;
		}

		public ClassificationInferenceOptionsDescriptor TopClassesResultsField(string? topClassesResultsField)
		{
			TopClassesResultsFieldValue = topClassesResultsField;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			if (NumTopClassesValue.HasValue)
			{
				writer.WritePropertyName("num_top_classes");
				writer.WriteNumberValue(NumTopClassesValue.Value);
			}

			if (NumTopFeatureImportanceValuesValue.HasValue)
			{
				writer.WritePropertyName("num_top_feature_importance_values");
				writer.WriteNumberValue(NumTopFeatureImportanceValuesValue.Value);
			}

			if (!string.IsNullOrEmpty(PredictionFieldTypeValue))
			{
				writer.WritePropertyName("prediction_field_type");
				writer.WriteStringValue(PredictionFieldTypeValue);
			}

			if (!string.IsNullOrEmpty(ResultsFieldValue))
			{
				writer.WritePropertyName("results_field");
				writer.WriteStringValue(ResultsFieldValue);
			}

			if (!string.IsNullOrEmpty(TopClassesResultsFieldValue))
			{
				writer.WritePropertyName("top_classes_results_field");
				writer.WriteStringValue(TopClassesResultsFieldValue);
			}

			writer.WriteEndObject();
		}
	}
}